home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
tex
/
nghelp.zip
/
NGCL.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-11-06
|
29KB
|
1,158 lines
{$A+,B-,E+,F-,I+,N-,O-,R-,V-}
{$DEFINE DEBUG}
{$IFDEF DEBUG} {$D+,L+,S+} {$ELSE} {$D-,L-,S-} {$ENDIF}
Unit NGCL;
Interface
Uses YNSystem,YNDos,YNCrt,FastScr,StrInt,Invoer,Help_Var,Window,NG;
Procedure InitVars_NG;
Procedure ChangeWindowSize(Big : Boolean);
Procedure LookUp(Beep : Boolean);
Procedure LoadNGGuide;
Procedure ProccessKeyStrokeNG; {Proccess a key stroke}
Procedure BuildScreenNG; {Build ng screen from nothing}
Procedure StartNG;
Implementation
Const MaxMenuBars = 13;
MaxPull = 8;
Type PullRec = Record
PullName : Array [1..MaxPull] of String[20]; {naam pulldown menu}
PullEntry : Array [1..MaxPull] of Longint;
End;
MenuStr = String[10];
SubStr = String[25];
Var UpdateMenu : Boolean; {When to refresh BG's menu}
UpdateSub : Boolean;
SubMenuActive : Boolean; {Needed to filter out keystrokes}
(* Menu interface voor NG *)
MainMenuStr : Array [1..MaxMenuBars] of MenuStr;{Standaard menus}
PullInfo : Array [3..MaxMenuBars] of PullRec;
MainMenuCount : Byte; {Max 255 mainmenus}
MainMenuBar : Byte; {Highlighted menu}
PullMenuBar : Byte;
SeeAlsoBar : Byte;
MainNum,
PullNum : Byte; {Voor Tag}
DrawSub : Boolean; {Draw the submenu from scratch}
SubMenu : WindowOBJ;
(* Var voor het norton guide hulp gedeelte *)
Short : Boolean;
GuideMenu : GuideMenuOBJ;
GuideShort : GuideShortOBJ;
GuideLong : GuideLongOBJ;
HTekst,STekst : Longint;
Procedure NGHelpScreen;
Var ExitCode : Char;
Loop : Byte;
Begin
With AskWindow Do
Begin
Init;
AddTitle(' About Help''s Norton Guide Cloon ');
AddLine(FillStr(Space,72));
AddLine(' <esc> Back one level <-> Show Previous long entry');
AddLine(' F9 Full/Half screen <+> Show Next long entry');
AddLine('^F10 Exit the guide');
AddLine('');
AddLine('^The Norton Guide Cloon incorporated in HELP');
AddLine('^Copyright 1991 by Yvo Nelemans');
AddLine('');
For Loop := 1 to 5 Do AddLine(' '+Copy(Credit(Loop),1,70));
AddLine('');
AddButton('Ok');
Go(ExitCode);
Done;
End;
End;
Procedure ChangeColor(Color : Boolean);
Begin
Default.Color := Color;
if Not Color then
Begin {Maak Black/White}
WindowC_NG := LightGray+BlackBG;
WindowH_NG := Black+LightGrayBG;
MenuC_NG := White+BlackBG;
BoldFase := White+BlackBG;
UnderLine := Green+BlackBG;
Reverse := Black+LightGrayBG;
End Else Begin {Maak Color}
WindowC_NG := LightCyan+BlueBG;
WindowH_NG := Black+CyanBG;
MenuC_NG := Yellow+BlueBG;
BoldFase := Yellow+BlueBG;
UnderLine := LightMagenta+BlueBG;
Reverse := Black + CyanBG;
End;
End;
Procedure ChangeWindowSize(Big : Boolean);
Begin
X1_NG := 1; X2_NG := 80;
Default.BigScreen := Big;
if Not Big then
Begin
if YPosition>12 then
Begin
Y1_NG := 1;
Y2_NG := Y1_NG+11;
End Else Begin
Y2_NG := MaxRows;
Y1_NG := Y2_NG-11;
End;
End Else Begin
Y1_NG := 1;
Y2_NG := MaxRows;
End;
End;
Procedure InitVars_NG;
Begin
UpdateMenu := False;
UpdateSub := False;
SubMenuActive := False;
DrawSub := True;
Short := True;
HTekst := 1; STekst := 1;
MainNum := 0; PullNum := 0;
ChangeColor(Default.Color);
End;
Procedure FreeGuideMem;
Begin
if NoGuide then Exit;
if Short then
With GuideShort Do Done
Else With GuideLong Do Done;
End;
Procedure ClearMenuVars;
Begin
MainMenuBar := 1; {Start met 'Expand' highlighted}
MainMenuStr[1] := 'Expand';
MainMenuStr[2] := 'Search...';
MainMenuStr[3] := 'Options';
FillChar(PullInfo,Sizeof(PullInfo),#0);
PullInfo[3].PullName[1] := 'Database';
PullInfo[3].PullName[2] := 'Color';
PullInfo[3].PullName[3] := 'Full screen F9';
PullInfo[3].PullName[4] := 'Auto lookup';
PullInfo[3].PullName[5] := 'Hot key';
PullInfo[3].PullName[6] := 'Uninstall';
PullInfo[3].PullName[7] := 'Save options';
{ PullInfo[3].PullName[8] := 'Go to THELP';}
MainMenuCount := 3; {3 menus}
PullMenuBar := 1;
End;
Procedure SubInfo(Var Len,Depth : Byte);
Var Loop : Byte;
Begin
Len := Length(PullInfo[MainMenuBar].PullName[1]);
Depth := 0;
For Loop := 1 to MaxPull Do
Begin
if Length(PullInfo[MainMenuBar].PullName[Loop])>Len then
Len := Length(PullInfo[MainMenuBar].PullName[Loop]);
if Length(PullInfo[MainMenuBar].PullName[Loop])<>0 then Inc(Depth)
End;
End;
Procedure ClearStatusLine;
Begin
Screen.FastWrite(2,2,WindowC_NG,FillStr(Space,78));
End;
Procedure WriteSubMenu;
Var Len,Depth,
Loop,XPos : Byte;
St : String[24];
Begin
UpdateSub := False;
if (MainMenuBar=1) Or (MainMenuBar=2) then Exit;
XPos := 3;
For Loop := 1 to Pred(MainMenuBar) Do
XPos := XPos + Length(MainMenuStr[Loop]) + 2;
SubInfo(Len,Depth);
if DrawSub then
Begin
DrawSub := False;
With SubMenu Do
Begin
Init;
SetColor(WindowC_NG);
SetSize(Depth,Len+3,SingleBrdr);
if XPos+Len+4>79 then XPos := 79-(Len+4);
ShowWindow(XPos,Y1_NG+2);
With Screen Do
Begin
vWindowIgnore := True;
FastPWrite(XPos,Y1_NG+2,#194);
FastPWrite(XPos+Len+4,Y1_NG+2,#194);
vWindowIgnore := False;
End;
End;
End;
For Loop := 1 to Depth Do With Screen Do
Begin
St := FillRight(' '+PullInfo[MainMenuBar].PullName[Loop],Len+3);
if MainMenuBar=3 then
Begin
if (Loop=2) And Default.Color then St[1] := #251;
if (Loop=4) And Default.AutoLookUp then St[1] := #251;
End;
if (MainMenuBar=MainNum) And (Loop=PullNum) then St[1] := #251;
if Loop=PullMenuBar then
FastWrite(1,Loop,WindowH_NG,St)
Else FastWrite(1,Loop,MenuC_NG,St);
End
End;
Procedure WriteMenuBar;
Var Loop,
XPos,
Color : Byte;
Begin
if Not UpdateMenu then Exit;
UpdateMenu := False;
XPos := 3;
With Screen Do
Begin
For Loop := 1 to MainMenuCount Do
Begin
if Loop=MainMenuBar then
FastWrite(XPos,2,WindowH_NG,Space+MainMenuStr[Loop]+Space)
Else FastWrite(XPos,2,MenuC_NG,Space+MainMenuStr[Loop]+Space);
XPos := XPos + Length(MainMenuStr[Loop]) + 2;
End;
End;
WriteSubMenu;
End;
Procedure ClearBar;
Begin
Screen.ChangeAttr(2,HTekst-STekst+4,WindowC_NG,78);
End;
Procedure WriteBar;
Begin
Screen.ChangeAttr(2,HTekst-STekst+4,WindowH_NG,78);
End;
Procedure FillWord(Var Dest;Width,Value : Word;Var XPos : Byte);
Begin
Inc(XPos,Width);
if CheckSnow then
Inline($C4/$BE/Dest/ { LES DI,Dest[BP] }
$8B/$8E/Width/ { MOV CX,Width[BP] }
$8B/$9E/Value/ { MOV BX,Value[BP] }
$FC/ { CLD }
$E3/$16/ { JCXZ READY }
$BA/$03DA/ { MOV DX,3DAH }
$B4/$09/ { MOV AH,9 }
$EC/ { TEST1: IN AL,DX }
$D0/$D8/ { RCR AL,1 }
$72/$FB/ { JB TEST1 }
$FA/ { CLI }
$EC/ { TEST2: IN AL,DX }
$22/$C4/ { AND AL,AH }
$74/$FB/ { JZ TEST2 }
$8B/$C3/ { MOV AX,BX }
$AB/ { STOSW }
$FB/ { STI }
$E2/$EF) Else { LOOP TEST1 }